package com.jiang.annotation.aop.global_exception_handle;

import com.google.common.base.MoreObjects;
import io.swagger.v3.oas.annotations.media.Schema;

import java.io.Serializable;

/**
 * @Author Administrator
 * @Date 2023 12 15 10 36
 **/
@Schema(
        title = "响应错误详情"
)
public class Error implements Serializable {
    private static final long serialVersionUID = 1L;
    @Schema(
            title = "Exception完整信息",
            type = "string"
    )
    private String detail;
    @Schema(
            title = "错误信息，目前主要是Validation的Message"
    )
    private String message;
    @Schema(
            title = "错误代码，目前主要是Validation的Code"
    )
    private String code;
    @Schema(
            title = "错误字段，目前主要是Validation的Field"
    )
    private String field;
    @Schema(
            title = "错误堆栈信息"
    )
    private StackTraceElement[] stackTrace;

    public Error() {
    }

    public String getDetail() {
        return this.detail;
    }

    public void setDetail(String detail) {
        this.detail = detail;
    }

    public String getMessage() {
        return this.message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public String getCode() {
        return this.code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getField() {
        return this.field;
    }

    public void setField(String field) {
        this.field = field;
    }

    public StackTraceElement[] getStackTrace() {
        return this.stackTrace;
    }

    public void setStackTrace(StackTraceElement[] stackTrace) {
        this.stackTrace = stackTrace;
    }

    public String toString() {
        return MoreObjects.toStringHelper(this).add("detail", this.detail).add("message", this.message).add("code", this.code).add("field", this.field).toString();
    }
}